import en from './locale/en.json'
import zh from './locale/zh-Hans.json'
const messages = {
	en,
	'zh-Hans': zh,
}

const lang = uni.getStorageSync('hhh-lang')
console.log(lang)

// console.log(uni.getLocale())
let i18nConfig = {
	locale: lang || 'en', // 获取已设置的语言
	messages
}


import App from './App'
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
// 如此配置即可
uni.$u.config.unit = 'rpx'
import tools from '@/utils/httpRequest'
import store from './store'
uni.$tools = tools;
// #ifndef VUE3
import Vue from 'vue'
// 注册全局方法
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
const i18n = new VueI18n(i18nConfig)
Vue.prototype.$t = (key) => i18n.t(key)
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'

import {
	globalMixin
} from './utils/mixin';
// 注册全局 mixin
Vue.mixin(globalMixin);
const app = new Vue({
	...App,
	i18n,
	store
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
import {
	createI18n
} from 'vue-i18n' // v9.x
const i18n = createI18n(i18nConfig)
export function createApp() {
	const app = createSSRApp(App)
	app.use(store)
	app.use(i18n)
	return {
		app
	}
}
// #endif